package com.alan.designMode.mediator.example_1;

/**
 * Created by Alan on 17-9-4
 */
public class Stock extends AbstractColleague{

    public Stock(AbstractMediator mediator) {
        super(mediator);
    }

    //刚开始有100台电脑
    private static int COMPUTER_NUMBER = 100;

    //获得库存数量
    public int getStockNumber() {
        return COMPUTER_NUMBER;
    }

    //库存降低
    public void decrease(Integer number) {
        COMPUTER_NUMBER = COMPUTER_NUMBER - number;
        System.out.println("库存数量为："+COMPUTER_NUMBER);
    }

    //库存增加
    public void increase(Integer number) {
        COMPUTER_NUMBER = COMPUTER_NUMBER + number;
        System.out.println("库存数量为："+COMPUTER_NUMBER);
    }

    //存货压力大了，就要通知采购人员不要采购，销售人员要尽快销售
    public void clearStock(){
        System.out.println("清理存货数量为："+COMPUTER_NUMBER);
        super.mediator.execute("stock.clear");
    }


}
